using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace Intro
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class SpriteEntity : Microsoft.Xna.Framework.DrawableGameComponent
    {
        private Texture2D spriteTexture;
        private Vector2 spritePosition;
        private Rectangle spriteRectangle;

        public SpriteEntity(Game game, ref Texture2D newTexture, Rectangle newRectangle, Vector2 newPosition)
            : base(game)
        {
            spriteTexture = newTexture;
            spritePosition = newPosition;
            spriteRectangle = newRectangle;
        }

        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here

            base.Initialize();
        }

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            // TODO: Add your update code here

            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            SpriteBatch spriteBatch = (SpriteBatch)Game.Services.GetService(typeof(SpriteBatch));

            spriteBatch.Draw(spriteTexture, spritePosition, spriteRectangle, Color.White);

            base.Draw(gameTime);
        }
    }
}
